package com.longge;

import java.util.Set;
import java.util.TreeSet;

public class DivingBoard {

    public int[] divingBoard(int shorter, int longer, int k) {

        if (k == 0) return new int[]{};
        Set<Integer> set = new TreeSet<>();

        for (int i = 0; i <= k; i++) {
            int longCount = k - i;
            set.add(shorter * i + longer * longCount);
        }
        int[] ans = new int[set.size()];
        int i = 0;
        for (Integer num : set) {
            ans[i++] = num;
        }
        return ans;
    }
}
